package com.codeshellme.bookmanager.service;

import com.codeshellme.bookmanager.dto.BookAuthor;
import com.codeshellme.bookmanager.dto.BookItem;
import com.github.pagehelper.PageInfo;

import java.util.List;
import java.util.Map;

public interface SysService {
    PageInfo<Map<String, Object>> querySysDict(Integer dictId, Integer fatherId, Integer pageNum, Integer pageSize);

    PageInfo<Map<String, Object>> queryAllAuthors(
            String name, Byte sex, Integer nationality_id, Byte status,
            String date_start, String date_end,
            Integer pageNum, Integer pageSize);

    PageInfo<Map<String, Object>> queryAllSysBooks(String name, Integer type_id, Integer author_id, Byte status,
                                                   String date_start, String date_end, String q,
                                                   Integer pageNum, Integer pageSize);

    /**
     * 查询国籍
     * @param q 搜索词
     */
    List<Map<String, Object>> queryAllNations(String q);

    /**
     * 查询图书类型
     * @param q 搜索词
     */
    List<Map<String, Object>> queryBookTypes(String q);

    /**
     * 查询图书作者
     * @param q 搜索词
     */
    List<Map<String, Object>> queryBookAuthors(String q);

    int updateAuthor(BookAuthor author);

    int addAuthor(BookAuthor author);

    int deleteAuthorById(Integer authorId);

    int updateBookItem(BookItem book);

    int addBookItem(BookItem book);

    int deleteBookItemById(Integer bookId);

    // 验证书名是否可用
    Boolean verifyBookItemName(String name);
}
